
#include <iostream>
#include <stack>

using namespace std;

int main(){
	char c;
	stack<char> s;

	do{
		cin >> c;
		if(c == '(')
			s.push(c);
		else if(c == ')'){
			if(!s.empty() && s.top() == '(')
				s.pop();
			else{
				cerr << "error 1" << endl;
				return 0;
			}
		}
	}while(c != '@');
	if(s.empty())
		cout << "ok" << endl;
	else
		cerr << "error 2" << endl;

	return 0;
}
